/* $Id: aconf.l 19 2011-02-24 21:25:02Z dheater@heatertech.com $ */

%{
#include <stdlib.h>
#include "symtab.h"
#include "aconf.tab.h"
extern YYSTYPE yylval;
%}

DIGIT  [0-9]
LETTER [A-Za-z]
WHITESPACE [ \t]

%%

("."{DIGIT}+) yylval.dval=strtod(yytext,NULL); return DOUBLE;
{DIGIT}+("."{DIGIT}+) yylval.dval=strtod(yytext,NULL); return DOUBLE;
{DIGIT}+(".") yylval.dval=strtod(yytext,NULL); return DOUBLE;
{DIGIT}+ yylval.ival=strtol(yytext, NULL, 10); return INT;
[Tt][Rr][Uu][Ee] { return TRUE; }
[Ff][Aa][Ll][Ss][Ee] { return FALSE; }
{LETTER}+({LETTER}|{DIGIT}|"_")* {
    if(yylval.sym = getsym(yytext)) {
        switch(yylval.sym->sym_type) {
            case SYM_UD:
                return UD;
                break;
            case SYM_ID:
                return ID;
                break;
            case SYM_UI:
                return UI;
                break;
            case SYM_II:
                return II;
                break;
            case SYM_UB:
                return UB;
                break;
            case SYM_IB:
                return IB;
                break;
        }
    }
}

[ \t] /* Ignore whitespace */

<<EOF>>  yyterminate();  /* signal end of dialogue */
\n       return yytext[0];
.        return yytext[0]; {
}

%%
